package com.gxa.service.investment.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gxa.dto.investmentDto.InvestmentPlanDto;
import com.gxa.entity.investment.InvestmentPlan;
import com.gxa.entity.investment.PlanAuthorization;
import com.gxa.mapper.investment.InvestmentPlanMapper;
import com.gxa.service.investment.InvestmentPlanService;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yjl
 * @since 2022-10-12 11:37:51
 */
@Service
public class InvestmentPlanServiceImpl extends ServiceImpl<InvestmentPlanMapper, InvestmentPlan> implements InvestmentPlanService {
    @Autowired
    private InvestmentPlanMapper investmentPlanMapper;

    @Override
    public void add(InvestmentPlan investmentPlan) {
        investmentPlanMapper.insert(investmentPlan);
    }

    @Override
    public void delete(int id) {
        investmentPlanMapper.deleteById(id);
    }

    @Override
    public List<InvestmentPlan> selectAll() {
        return investmentPlanMapper.selectList(null);
    }

    @Override
    public void update(InvestmentPlan investmentPlan) {
        this.investmentPlanMapper.updateById(investmentPlan);
    }

    @Override
    public PageInfo queryByInvestmentPlanDto(InvestmentPlanDto investmentPlanDto, Integer pageNum, Integer pageSize) {
        Page<InvestmentPlan> page = PageHelper.startPage(pageNum,pageSize);
        List<InvestmentPlan> investmentPlanList = this.investmentPlanMapper.queryByInvestmentPlanDto(investmentPlanDto);
        PageInfo<InvestmentPlan> pageInfo = new PageInfo<>(investmentPlanList);

        return pageInfo;
    }


}
